'use strict'
const path = require('path')
const {
	defineConfig
} = require('@vue/cli-service')
const defaultSetting = require('./src/settings') // 默认配置

function resolve(dir) {
	return path.join(__dirname, dir)
}

const name = defaultSetting.title || 'Vue Admin' // page title

module.exports = defineConfig({
	lintOnSave: false,
	publicPath: './',
	outputDir: 'dist',
	assetsDir: 'static',
	productionSourceMap: false,
	devServer: {
		https: false,
		port: 5337,
		open: false,
		proxy: {
			'/main': {
				target: 'http://127.0.0.1:3540',
				ws: true,
				changeOrigin: true,
				pathRewrite: {
					'^/main': '',
				}
			},
			'/test': {
				target: 'http://127.0.0.1:8000',
				ws: true,
				changeOrigin: true,
				pathRewrite: {
					'^/test': '',
				}
			}
		},
	},
	configureWebpack: {
		// provide the app's title in webpack's name field, so that
		// it can be accessed in index.html to inject the correct title.
		name: name,
		resolve: {
			alias: {
				'@': resolve('src')
			}
		}
	},
})
